package com.hyh.shiyanshiguanli.mapper;

import com.hyh.shiyanshiguanli.domain.entity.Instrument;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author hyh
 * @version 1.0
 */
@Mapper
public interface InstrumentMapper {

    @Select("select * from instrument where id = #{instrumentId}")
    Instrument selectById(@Param("instrumentId") Integer instrumentId);

    @Update("update instrument set num = num - #{num} where id = #{id} ")
    void deleteNum(@Param("num") Integer num,@Param("id") Integer id);

    @Update("update instrument set num = num + #{needNum} where id = #{instrumentId} ")
    void addNum(@Param("needNum") Integer needNum,@Param("instrumentId")  Integer instrumentId);
}
